<template>
	<view v-if="show" class="unio2o-coupon-activity-alert">
		<view class="alert-div" :class="show ? 'animated zoomInUp' : ''">
			<view class="box ">
				<!-- 添加标题区域 -->
				<view class="activity-title">
					<text class="title-text">限时优惠券活动</text>
					<text class="subtitle-text">专享优惠，立即领取</text>
				</view>

				<view class="pd40">
					<view class="coupon-item mb30 bdr16" style="background-color:#FFFFFF;">
						<view class="pd40 flex space">
							<view class="coupon-l text-price pr30">
								<view class="text-center">
									<text class="ft14">￥</text>
									<text class="ft18 ftw600">10</text>
								</view>
								<view class="mt10 ft12">满30可用</view>
							</view>
							<view class="coupon-r pl50">
								<view class="ft16 ftw600 text-main">每满80减20元券</view>
								<view class="mt20 ft12 text-info">
									美食类通用
								</view>
							</view>
						</view>
					</view>

					<view class="coupon-item mb30 bdr16" style="background-color:#FFFFFF;">
						<view class="pd40 flex space">
							<view class="coupon-l text-price pr30">
								<view class="text-center">
									<text class="ft14">￥</text>
									<text class="ft18 ftw600">10</text>
								</view>
								<view class="mt10 ft12">满30可用</view>
							</view>
							<view class="coupon-r pl50">
								<view class="ft16 ftw600 text-main">每满80减20元券</view>
								<view class="mt20 ft12 text-info">
									美食类通用
								</view>
							</view>
						</view>
					</view>


				</view>

				<view class="pd30 flex center alcenter activity-banner">
					<navigator url="/pages/coupon/activity">
						<button class="btn">
							进入专区
						</button>
					</navigator>
				</view>

			</view>
			<view class="flex center mt20" @click="closeAlert">
				<app-icon name="iconbtn_close_black" size="48" color="#fff"></app-icon>
			</view>
		</view>
	</view>
</template>

<script>
import { mapGetters, mapActions } from 'vuex';

export default {
	components: {
		
	},
	data() {
		return {
			show: false
		};
	},
	computed: {
		...mapGetters('user', ['isCouponActivityClosed'])
	},
	created() {
		// 检查是否已关闭过优惠券活动弹窗
		if (!this.isCouponActivityClosed) {
			setTimeout(() => {
				this.show = true;
			}, 1000);
		}
	},
	methods: {
		...mapActions('user', ['setCouponActivityClosed']),
		
		// 关闭弹窗并记录状态
		closeAlert() {
			this.show = false;
			this.setCouponActivityClosed();
		}
	}
}
</script>

<style>
/*弹窗用400的层级*/
.unio2o-coupon-activity-alert {
	background: rgba(0, 0, 0, .3);
	width: 100%;
	height: 100vh;
	position: fixed;
	z-index: 400;
	left: 0;
	top: 0;
}

.unio2o-coupon-activity-alert .alert-div {
	position: fixed;
	width: 630rpx;
	left: calc(50% - 315rpx);
	top: 50%;
	z-index: 402;
	transform: translateY(-50%);
}

.unio2o-coupon-activity-alert .box {
	width: 100%;
	background: #F34E52;
	border-radius: 16rpx;
	overflow: hidden;
	box-shadow: 0 10rpx 30rpx rgba(243, 78, 82, 0.3);
}

/* 标题样式 */
.activity-title {
	padding: 30rpx 0;
	text-align: center;
	background: linear-gradient(135deg, #F34E52, #FF6B6B);
	position: relative;
	overflow: hidden;
}

.activity-title::before {
	content: '';
	position: absolute;
	top: -50rpx;
	left: -50rpx;
	width: 200rpx;
	height: 200rpx;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
}

.activity-title::after {
	content: '';
	position: absolute;
	bottom: -50rpx;
	right: -50rpx;
	width: 150rpx;
	height: 150rpx;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.1);
}

.title-text {
	font-size: 38rpx;
	font-weight: bold;
	color: #FFFFFF;
	letter-spacing: 2rpx;
	position: relative;
	z-index: 1;
}

.subtitle-text {
	display: block;
	font-size: 24rpx;
	color: rgba(255, 255, 255, 0.8);
	margin-top: 10rpx;
	position: relative;
	z-index: 1;
}

.unio2o-coupon-activity-alert .close {
	width: 96rpx;
	height: 96rpx;
}

.unio2o-coupon-activity-alert .coupon-item {
	width: 550rpx;
	height: 168rpx;
	box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
	transition: transform 0.2s ease;
}

.unio2o-coupon-activity-alert .coupon-item:active {
	transform: scale(0.98);
}

.unio2o-coupon-activity-alert .coupon-item .coupon-l {
	width: 140rpx;
}

.unio2o-coupon-activity-alert .coupon-item .coupon-r {
	width: calc(100% - 140rpx);
}

.activity-header {
	width: 100%;
}

.activity-header image {
	width: 100%;
}

.activity-banner {
	background: linear-gradient(135deg, #F23A3D, #E03131);
	padding: 40rpx 30rpx;
}

.activity-banner .btn {
	width: 430rpx;
	height: 88rpx;
	background: linear-gradient(135deg, #FFAA00, #FF922B);
	border-radius: 44rpx;
	font-size: 36rpx;
	font-weight: 600;
	color: #fff;
	line-height: 88rpx;
	box-shadow: 0 6rpx 16rpx rgba(255, 170, 0, 0.3);
	transition: all 0.2s ease;
}

.activity-banner .btn:active {
	transform: scale(0.95);
	box-shadow: 0 3rpx 8rpx rgba(255, 170, 0, 0.2);
}
</style>